package com.nbsaas.boot.example.rest.convert;

import com.nbsaas.boot.example.data.entity.Example;
import com.nbsaas.boot.example.api.domain.simple.ExampleSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 客户案例-列表对象转换器
*/

public class ExampleSimpleConvert implements Converter<ExampleSimple, Example> {




@Override
public ExampleSimple convert(Example source) {
    ExampleSimple result = new ExampleSimple();

                result.setNote(source.getNote());

               try {
                   if(source.getCreator()!=null){
                       result.setCreator(source.getCreator().getId());
                   }
                } catch (Exception ignored) { }


               try {
                   if(source.getExampleCatalog()!=null){
                       result.setExampleCatalog(source.getExampleCatalog().getId());
                   }
                } catch (Exception ignored) { }

                result.setIntroduce(source.getIntroduce());

                try {
                    if(source.getCreator()!=null){
                        result.setCreatorName(source.getCreator().getName());
                    }
                } catch (Exception ignored) { }

                result.setAddDate(source.getAddDate());
                result.setUrl(source.getUrl());
                result.setName(source.getName());
                result.setLogo(source.getLogo());

                try {
                    if(source.getExampleCatalog()!=null){
                        result.setExampleCatalogName(source.getExampleCatalog().getName());
                    }
                } catch (Exception ignored) { }

                result.setSortNum(source.getSortNum());
                result.setId(source.getId());
                result.setLastDate(source.getLastDate());


    return result;
}

}